package com.haiya.infrastructure.rpc.salessystem;

import com.haiya.domain.aggregate.cargo.Cargo;
import com.haiya.domain.aggregate.cargo.valueobject.EnterpriseSegment;
import com.haiya.infrastructure.rpc.salessystem.dataobject.UserDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author qiaoguoqiang
 */
@Service
public class SalersService {
    @Autowired
    private RemoteServiceAdapter adapter;

    /**
     * 根据手机号查询销售用户名
     *
     * @param phone
     * @return
     */
    private String getUserName(String phone) {
        UserDO user = this.adapter.getUser(phone);
        return null == user ? null : user.getName();
    }

    public EnterpriseSegment deriveEnterpriseSegment(Cargo cargo) {
        return this.adapter.deriveEnterpriseSegment(cargo);
    }

    public boolean mayAccept(int cargoSize, Cargo cargo) {
        return this.adapter.mayAccept(cargoSize, cargo);
    }
}
